package com.shuyuntu.proposal.controller;

import com.shuyuntu.proposal.entity.Permission;
import com.shuyuntu.proposal.security.UseSecurity;
import com.shuyuntu.proposal.service.PermissionService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created by limeng on 16/7/26.
 */
@Controller
@RequestMapping("/permission")
public class PermissionController {
    @Resource
    PermissionService permissionService;

    public PermissionService getPermissionService() {
        return permissionService;
    }

    public void setPermissionService(PermissionService permissionService) {
        this.permissionService = permissionService;
    }

    /**
     * 获取所有的权限信息
     * @return jsonList
     */
    @ResponseBody
    @RequestMapping(method = RequestMethod.GET)
    @UseSecurity(category = "0601")
    public List<Permission> getPermissionInfos(HttpSession session) {
        return permissionService.getPermissionInfos();
    }
}
